package com.guess.study.designpattern.factory.simplefactory.factory;

import com.guess.study.designpattern.factory.simplefactory.product.ConcreteProductA;
import com.guess.study.designpattern.factory.simplefactory.product.ConcreteProductB;
import com.guess.study.designpattern.factory.simplefactory.product.Product;

/**
 * Created by tianran on 2019-06-06.
 */
public class Creator {

    public static Product createProduct(String type) {
        Product product = null;
        switch (type) {
            case "A":
                product = new ConcreteProductA();
                break;
            case "B":
                product = new ConcreteProductB();
                break;
        }
        return product;
    }
}
